from rest_framework.viewsets import ModelViewSet
from rest_framework.generics import ListAPIView
from django.contrib.auth.models import Permission

from apps.meiduo_admin.serializers.admin_permission import PermissionSerializer, PermissionSimpleSerializer
from apps.meiduo_admin.utils.pagination import MeiduoPagination
#用户的管理权限  权限的增删改查  全部封装在权限管理的所有操作里面
class PermissionViewSet(ModelViewSet):
    queryset = Permission.objects.all()
    serializer_class = PermissionSerializer
    pagination_class = MeiduoPagination

#在用户组管理中 增加用户时 显示的权限进行获取  在权限框中显示出来
class PermissionSimpleView(ListAPIView):
    queryset = Permission.objects.all()
    serializer_class = PermissionSimpleSerializer